package org.appfuse.model;

import java.sql.Date;

import org.apache.commons.lang.StringUtils;

/**
 * @struts.form include-all="true" extends="org.appfuse.webapp.form.BaseForm"
 * @hibernate.class table="dutyinfo"
 */

public class Dutyinfo extends org.appfuse.model.BaseObject implements
		java.io.Serializable, Comparable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = -7288056576947627622L;

	private Integer id;

	private BasicInfo basicInfo;

	private String zc;

	private Date hdrq;

	private String a00;

	protected String hdzgtj;

	protected String pwhhksmc;

	protected String zcjb;

	// Constructors

	public String getHdzgtj() {
		return hdzgtj;
	}

	public void setHdzgtj(String hdzgtj) {
		this.hdzgtj = hdzgtj;
	}

	public String getPwhhksmc() {
		return pwhhksmc;
	}

	public void setPwhhksmc(String pwhhksmc) {
		this.pwhhksmc = pwhhksmc;
	}

	public String getA00() {
		return a00;
	}

	public void setA00(String a00) {
		this.a00 = a00;
	}

	/** default constructor */
	public Dutyinfo() {
	}

	/** full constructor */
	public Dutyinfo(String zc, Date hdrq) {
		this.zc = zc;
		this.hdrq = hdrq;
	}

	// Property accessors

	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public BasicInfo getBasicInfo() {
		return basicInfo;
	}

	public void setBasicInfo(BasicInfo basicInfo) {
		this.basicInfo = basicInfo;
		this.a00 = basicInfo.getId();
	}

	public String getZc() {
		return this.zc;
	}

	public void setZc(String zc) {
		this.zc = zc;
		if (!StringUtils.isEmpty(zc)) {
			char c = zc.charAt(zc.length() - 1);
			if (c > '5'){
				c = '5';
			}
			this.zcjb = String.valueOf(c);
		}
	}

	public Date getHdrq() {
		return this.hdrq;
	}

	public void setHdrq(Date hdrq) {
		this.hdrq = hdrq;
	}

	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int hashCode() {
		final int PRIME = 31;
		int result = 1;
		result = PRIME * result + ((a00 == null) ? 0 : a00.hashCode());
		result = PRIME * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final Dutyinfo other = (Dutyinfo) obj;
		if (a00 == null) {
			if (other.a00 != null)
				return false;
		} else if (!a00.equals(other.a00))
			return false;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}

	public String getZcjb() {
		return zcjb;
	}

	public void setZcjb(String zcjb) {
		this.zcjb = zcjb;
	}

	public int compareTo(Object o) {
		Dutyinfo theObject = (Dutyinfo) o;
		if (!StringUtils.isEmpty(theObject.getZcjb())) {
			return theObject.getZcjb().compareToIgnoreCase(this.zcjb);
		} else {
			return -1;
		}
	}

}